class MyClass:
    name = "小明"
    def __init__(self):
        self.age = 18
    def instance_method(self):       # 实例方法
        self.__class__.name = "小红"
        print("实例方法")

    @classmethod
    def class_method(cls):          # 类方法
        print("类方法")
        # print(f"{cls.name}的年龄为{cls.age}")
        cls.instance_method()
    @staticmethod
    def static_method():            # 静态方法
        print("静态方法")

    

# # MyClass.instance_method()
# MyClass.class_method()
# MyClass.static_method()

# mcs = MyClass()
# # mcs.instance_method2()
# mcs.class_method()
# # mcs.static_method()


print(MyClass.name)
a = MyClass()
print(MyClass.name)